Prevent Theme
resource from emitting changes during bulk operations
#49227
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bulk operations from #46593 and #46808 were progressively slow whenever executed with the Inspector open. This is due to each and every change to the edited
Theme
resource being propagated and causing a full Inspector rebuild. To circumvent this I've added an internal way to freeze change propagation inTheme
and allowed the theme editor to use it directly.This is not a very safe way to do this, though I have no other ideas currently. The fact that it's a private method only accessible due to being a
friend
class should be a warning enough to use with care, I hope. A short brainstorming discussion on RC didn't result in a better idea 🙃The result is great, though, as the resource is updated very quickly now, only getting stuck on the last step as the editor itself is being updated. To make sure that the user understands what's going on, the theme import progress bar has been updated to hang on a very specific step:
This is potentially useful for all resources, or maybe even objects. Maybe this can be refactored at some point to something more universal.